def function_factory():
    static_var = 0  # 闭包中的变量
    
    def inner_function(a):
        nonlocal static_var
        static_var += a
        print(f"调用次数: {static_var}")
    
    return inner_function

# 创建函数实例
my_function = function_factory()

# 测试
my_function(2)  # 调用次数: 1
my_function(3)  # 调用次数: 2

